package com.jinke.api.security.util;


public class ApiUserUtil {

    public static ThreadLocal<Integer> UserIdThreadLocal = new ThreadLocal<>();

    /**
     * 获取当前用户信息
     *
     * @return UserInfoBO
     */
    public static Integer getUserInfo() {
        return UserIdThreadLocal.get();
    }

    public static Integer getUserId() {
        return UserIdThreadLocal.get();
    }

    /**
     * 设置当前用户信息
     *
     * @return UserInfoBO
     */
    public static void setUserInfo(Integer userInfo) {
        UserIdThreadLocal.set(userInfo);
    }

    /**
     * 清除当前用户信息
     *
     * @return UserInfoBO
     */
    public static void clean() {
        UserIdThreadLocal.remove();
    }
}
